<?php defined('RUN_KATANA') or die('Restricted access'); ?>
	<span class="info"><?php echo ucfirst($txt->getWord('first_image_displayed_in_listview')); ?></span>
	<table class="zebra com_list" cellspacing="0" cellpadding="0" border="0" style="width:100%;">
        <thead class="fields">
			<tr>
				<th class="first" style="text-align:center;">&nbsp;&nbsp;#&nbsp;&nbsp;</th>
				<th class="nowrap"><?php echo ucfirst($txt->getWord('image')); ?>&nbsp;&nbsp;</th>
				<th class="nowrap"><?php echo ucfirst($txt->getWord('order')); ?>&nbsp;&nbsp;</th>
				<th class="nowrap"><?php echo ucfirst($txt->getWord('rotate').' '.$txt->getWord('counterclockwise').' 90&deg;'); ?>&nbsp;&nbsp;</th>
				<th class="nowrap"><?php echo ucfirst($txt->getWord('rotate').' '.$txt->getWord('clockwise').' 90&deg;'); ?>&nbsp;&nbsp;</th>
				<th class="last"><?php echo ucfirst($txt->getWord('delete')); ?></th>
			</tr>
		</thead>
		<tbody>
			<?php 
			if($adc->CurrentAd->getImages()): ?>
				<?php 
				$thsize = '';
				if(count($thumb['ADS']) > 1)
				{ $thsize = $thumb['ADS'][(count($thumb['ADS'])-1)]['MAXW'].'_'; }
				foreach($adc->CurrentAd->getImages() as $img)
				{
					if($img->getId() > 0)
					{
					?>
					<tr class="items">
						<td class="first nowrap">&nbsp;&nbsp;<?php echo ($img->getimageOrder()+1); ?>&nbsp;&nbsp;<input type="hidden" name="img_id[]" value="<?php echo $img->getId(); ?>" /></td>
						<td class="left nowrap">
							<a target="_blank" class="fancyBox" href="<?php echo ADS_URL.$img->getFilename(); ?>"><img alt="<?php echo ucfirst($txt->getWord('uploaded_image').' '.$txt->getWord('click_to_view_original_version')); ?>" src="<?php echo $img->getLink(200, 150); ?>"></a>&nbsp;&nbsp;
						</td>
						<td class="center nowrap">
							<img class="icon command" title="<?php echo ucfirst($txt->getWord('move_up')); ?>" onmouseup="document.getElementById('<?php echo $com->getId(); ?>_editor_ad').submit();" onmousedown="document.getElementById('up').value='<?php echo $img->getId(); ?>'" src="<?php echo SYSICONS_URL; ?>arrow_up_16.gif" />
							<img class="icon command" title="<?php echo ucfirst($txt->getWord('move_down')); ?>" onmouseup="document.getElementById('<?php echo $com->getId(); ?>_editor_ad').submit();" onmousedown="document.getElementById('down').value='<?php echo $img->getId(); ?>'" src="<?php echo SYSICONS_URL; ?>arrow_down_16.gif" />&nbsp;&nbsp;
							
						</td>
						<td class="center nowrap">
							<img class="icon command" title="<?php echo ucfirst($txt->getWord('rotate').' '.$txt->getWord('counterclockwise').' 90&deg;'); ?>" onmouseup="document.getElementById('<?php echo $com->getId(); ?>_editor_ad').submit();" onmousedown="document.getElementById('rotate_ccw').value='<?php echo $img->getId(); ?>'" src="<?php echo SYSICONS_URL; ?>rotate_ccw_16.png" />&nbsp;&nbsp;
							
						</td>
						<td class="center nowrap">
							<img class="icon command" title="<?php echo ucfirst($txt->getWord('rotate').' '.$txt->getWord('clockwise').' 90&deg;'); ?>" onmouseup="document.getElementById('<?php echo $com->getId(); ?>_editor_ad').submit();" onmousedown="document.getElementById('rotate_cw').value='<?php echo $img->getId(); ?>'" src="<?php echo SYSICONS_URL; ?>rotate_cw_16.png" />&nbsp;&nbsp;
							
						</td>
						<td valign="middle" class="center nowrap"><img title="<?php echo ucfirst($txt->getWord('delete_image')); ?>" class="deleteImageButton icon command " src="<?php echo SYSICONS_URL; ?>delete_16.gif" rel="<?php echo $img->getId(); ?>" />&nbsp;&nbsp;
						</td>
					</tr>
					<?php 
					}
				}
				?>
			<?php endif; ?>
		</tbody>
    </table>
	<input type="hidden" id="del_image_id" name="del_img_id" value="0" />
	<input type="hidden" id="up" name="up" value="0" />
	<input type="hidden" id="down" name="down" value="0" />
	<input type="hidden" id="rotate_ccw" name="rotate_ccw" value="0" />
	<input type="hidden" id="rotate_cw" name="rotate_cw" value="0" />
<script type="text/javascript">

$(function() {
	jQuery('#del_image_dialog').dialog({
		autoOpen: false,
		bgiframe: true,
		resizable: false,
		height:140,
		modal: true,
		overlay: 
		{
			backgroundColor: '#000',
			opacity: 0.5
		},
		buttons: 
		{
			'<?php echo ucfirst($txt->getWord('no')); ?>': function() 
			{
				jQuery('#del_image_id').val(0);
				jQuery(this).dialog('close');
			},
			'<?php echo ucfirst($txt->getWord('yes')); ?>': function() 
			{
				jQuery(this).dialog('close');
				jQuery('#<?php echo $com->getId(); ?>_editor_ad').submit();
			}
		}
	});
});

jQuery(".deleteImageButton").click(function() { deleteImageDialog($(this).attr('rel')); /* $( "#dialog-form" ).dialog( "open" );*/ });
function deleteImageDialog(itemId)
{
	jQuery('#del_image_id').val(itemId);
	jQuery('#del_image_dialog').dialog('open');
}
</script>
<div id="del_image_dialog" title="<?php echo ucfirst($txt->getWord('delete_image')); ?>?" style="display:none; text-align:left;">
	<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><?php echo ucfirst($txt->getWord('sure_you_want_to_delete')); ?></p>
</div>